<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<base href="<%=basePath%>">
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>管理</title>
<style type="text/css">
<!--
body {
	margin-left: 3px;
	margin-top: 0px;
	margin-right: 3px;
	margin-bottom: 0px;
}
.STYLE1 {
	color: #e1e2e3;
	font-size: 12px;
}
.STYLE6 {color: #000000; font-size: 12; }
.STYLE10 {color: #000000; font-size: 12px; }
.STYLE19 {
	color: #344b50;
	font-size: 12px;
}
.STYLE21 {
	font-size: 12px;
	color: #3b6375;
}
.STYLE22 {
	font-size: 12px;
	color: #295568;
}
A:active,A:visited,A:link {
	COLOR: #0629FD;
	TEXT-DECORATION: none
}

A:hover {
	COLOR: #FF6600;
	TEXT-DECORATION: none
}

A.relatelink:active,A.relatelink:visited,A.relatelink:link { 
	color: white;
	TEXT-DECORATION: none
}

A.relatelink:hover {
	COLOR: #FF6600;
	TEXT-DECORATION: none
}

td {
	font-size: 12px;
	color: #003366;
	height:24px
}

.STYLE1 a{
	COLOR: white;
}
.STYLE1 A:active,.STYLE1 A:visited,.STYLE1 A:link {
	COLOR: white;
	TEXT-DECORATION: none
}
.STYLE1 a:hover{
	COLOR: red;
}
.buttom{
	padding:1px 10px;
	font-size:12px;
	border:1px #1E7ACE solid;
	background:#D0F0FF;
}
-->
</style>

<script type="text/javascript">

	function updateStaff(id){
		window.location.href = '<%=path%>/staff/updateStaffForm.action?id='+id;
	}
	
	function cancelStaff(id){
		 if(confirm("你确认要注销该员工?")) {
			 window.location.href = '<%=path%>/staff/cancelStaff.action?id=' + id;
		}
	}
</script>

</head>
<body>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="30"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td height="24" ><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="94%" valign="bottom" colspan="2"><h3>员工信息列表</h1></span></td>
              </tr>
            </table></td>
            <!-- 
            <td><div align="right"><span class="STYLE1">
             &nbsp;&nbsp;<img src="images/add.gif" width="10" height="10" /> <a href="#">添加</a>   
             &nbsp;&nbsp;<img src="images/edit.gif" width="10" height="10" /> <a href="#">发布</a>
             &nbsp; <img src="images/del.gif" width="10" height="10" /> <a href="#">删除</a>    &nbsp;&nbsp;   &nbsp;
             </span><span class="STYLE1"> &nbsp;</span></div></td> -->
          </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
<tr></tr>
  <!-- 查询 -->  
  		<form action="staff/showStaff.action" method="post">
  		 <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#a8c7ce">
  			<tr>
  				<td colspan="5" align="left"  bgcolor="d3eaef" class="STYLE6">信息查询</td>
  			</tr>
  			<tr>
  				<td align="left" bgcolor="#FFFFFF" class="STYLE19">姓名：</td>
  				<td bgcolor="#FFFFFF" class="STYLE19"><input type="text" name="name" value="${s.name }"></td>
  				<td align="left" bgcolor="#FFFFFF" class="STYLE19">账号：</td>
  				<td bgcolor="#FFFFFF" class="STYLE19"><input type="text" name="username" value="${s.username }"></td>
  			</tr>
  			<tr>
  				<td align="left" bgcolor="#FFFFFF" class="STYLE19">手机：</td>
  				<td  bgcolor="#FFFFFF" class="STYLE19"><input type="text" name="telephone" value="${s.telephone }"></td>
  				<td align="left" bgcolor="#FFFFFF" class="STYLE19">状态：</td>
  				<td bgcolor="#FFFFFF" class="STYLE19">
  					<select name="status">
  						<option value="" >全部</option>
						<option value="0" <c:if test="${s.status == 0}">selected</c:if>>离职</option>
						<option value="1" <c:if test="${s.status == 1}">selected</c:if>>在职</option>
					</select>
  				</td>
  				
  			</tr>
  			<tr>
  				<td colspan="5" bgcolor="#FFFFFF" class="STYLE19"><input type="submit" name="submit" value="查询"></td>
  			</tr>
  		</table>
  		</form>
  		  	
  <tr>
    <td>
    <table align="center" width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#a8c7ce">
      <tr>
        <td width="10%" height="20" bgcolor="d3eaef" class="STYLE6"><div align="left"><span class="STYLE10">姓名</span></div></td>
        <td width="10%" height="20" bgcolor="d3eaef" class="STYLE6"><div align="left"><span class="STYLE10">账号</span></div></td>
        <td width="10%" height="20" bgcolor="d3eaef" class="STYLE6"><div align="left"><span class="STYLE10">密码</span></div></td>
        <td width="10%" height="20" bgcolor="d3eaef" class="STYLE6"><div align="left"><span class="STYLE10">手机号</span></div></td>
        <td width="5%" height="20" bgcolor="d3eaef" class="STYLE6"><div align="left"><span class="STYLE10">状态</span></div></td>
        <td width="15%" height="20" bgcolor="d3eaef" class="STYLE6"><div align="right"><span class="STYLE10">创建日期&nbsp;</span></div></td>
        <td width="15%" height="20" bgcolor="d3eaef" class="STYLE6"><div align="right"><span class="STYLE10">最后登录时间&nbsp;</span></div></td>
        <td width="10%" height="20" bgcolor="d3eaef" class="STYLE6" colspan="5"><div align="left"><span class="STYLE10">&nbsp;操作</span></div></td>
      </tr>
      <tr>
       
<c:forEach items="${staffList}" var="u">
	  <tr>
	   	<td height="20" bgcolor="#FFFFFF" class="STYLE19"><div align="left">${u.name }</div></td>
        <td height="20" bgcolor="#FFFFFF" class="STYLE19"><div align="left">${u.username }</div></td>
        <td height="20" bgcolor="#FFFFFF" class="STYLE19"><div align="left">${u.password}</div></td>
        <td height="20" bgcolor="#FFFFFF" class="STYLE19"><div align="left">${u.telephone }</div></td>
        <td height="20" bgcolor="#FFFFFF" class="STYLE19"><div align="left">
        <c:choose><c:when test="${u.status == 0}">离职</c:when><c:otherwise>在职</c:otherwise></c:choose>
        </div>
        </td>
        <td height="20" bgcolor="#FFFFFF" class="STYLE19"><div align="right"><fmt:formatDate value="${u.createtime}" pattern="yyyy-MM-dd HH:MM:ss"/>&nbsp;</div></td>
        <td height="20" bgcolor="#FFFFFF" class="STYLE19"><div align="right"><fmt:formatDate value="${u.lasttime}" pattern="yyyy-MM-dd HH:MM:ss"/>&nbsp;</div></td>
   		<td bgcolor="#FFFFFF" class="STYLE19" align="left">
   			<span onclick="updateStaff('${u.id }');"><input type="button" value="修改" class="buttom" /></span>
   			<span onclick="cancelStaff('${u.id }');"><input type="button" value="注销" class="buttom" /></span>
   		</td>
	  </tr>
</c:forEach>   	
        </div></td>
      </tr>
    </table>
    
    
    </td>
  </tr>
  <tr>
    <td height="30">
    
    <form action="<c:url value='/staff/showStaff.action'/>">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td align=right vAlign="center" noWrap>
        <div align="right"><span align="right" class="STYLE22">&nbsp;&nbsp;&nbsp;&nbsp;共有<strong> ${count }</strong> 条记录
        当前第 <strong>${curPage}</strong>页
        共 <strong>${pageNumber}</strong>页
  <a href="<c:url value='/staff/showStaff.action?pages=1'/>">第一页</a>
        <c:choose>
			<c:when test="${curPage == 1}">
	    	   	上一页
	    	</c:when>
			<c:otherwise>
				<a href="<c:url value='/staff/showStaff.action?pages=${curPage-1}'/>">上一页</a>
			</c:otherwise>
		</c:choose>
		转到第<input name="pages" type="text" value="${curPage}" size="1"/> <input type="submit" class="buttom" value="页" />
		<c:choose>
			<c:when test="${curPage == pageNumber}">
	    	   	下一页
	    	</c:when>
			<c:otherwise>
				<a href="<c:url value='/staff/showStaff.action?pages=${curPage+1}'/>">下一页</a>
			</c:otherwise>
		</c:choose>
		<a href="<c:url value='/staff/showStaff.action?pages=${pageNumber}'/>">最后一页</a>
		   ${msg}
  	<c:remove var="msg" scope="session"/>
        </span></div></td>
        
      </tr>
    </table>
    </form>
    </td>
  </tr>
</table>
</body>
</html>

